}
$t = "<a href=\"{$u}\"{$style}>{$text}{$inside}</a>";
-
+
wfProfileOut( $fname );
return $t;
} elseif ( $nt->isAlwaysKnown() ) {
wfProfileOut( $fname );
return $text;
}
-
+
$u = $nt->escapeLocalURL( $query );
if ( '' != $nt->getFragment() ) {
if( $nt->getPrefixedDbkey() == '' ) {
$style = $this->getInternalLinkAttributesObj( $nt, $text );
if ( $aprops !== '' ) $aprops = ' ' . $aprops;
-
+
list( $inside, $trail ) = Linker::splitTrail( $trail );
$r = "<a href=\"{$u}\"{$style}{$aprops}>{$prefix}{$text}{$inside}</a>{$trail}";
wfProfileOut( $fname );
$text = htmlspecialchars( $nt->getPrefixedText() );
}
$style = $this->getInternalLinkAttributesObj( $nt, $text, "yes" );
-
+
list( $inside, $trail ) = Linker::splitTrail( $trail );
$s = "<a href=\"{$u}\"{$style}>{$prefix}{$text}{$inside}</a>{$trail}";
}
/** @todo document */
- function makeImageLinkObj( $nt, $label, $alt, $align = '', $width = false, $height = false, $framed = false,
- $thumb = false, $manual_thumb = '' )
+ function makeImageLinkObj( $nt, $label, $alt, $align = '', $width = false, $height = false, $framed = false,
+ $thumb = false, $manual_thumb = '' )
{
global $wgContLang, $wgUser, $wgThumbLimits;
-
+
$img = new Image( $nt );
+ if ( !$img->allowInlineDisplay() ) {
+ return $this->makeKnownLinkObj( $nt );
+ }
+
$url = $img->getViewURL();
$prefix = $postfix = '';
-
+
wfDebug( "makeImageLinkObj: '$width'x'$height'\n" );
-
+
if ( 'center' == $align )
{
$prefix = '<div class="center">';
$align = $wgContLang->isRTL() ? 'left' : 'right';
}
-
+
if ( $width === false ) {
$wopt = $wgUser->getOption( 'thumbsize' );
if( !isset( $wgThumbLimits[$wopt] ) ) {
$wopt = User::getDefaultOption( 'thumbsize' );
}
-
+
$width = min( $img->getWidth(), $wgThumbLimits[$wopt] );
}
-
+
return $prefix.$this->makeThumbLinkObj( $img, $label, $alt, $align, $width, $height, $framed, $manual_thumb ).$postfix;
}
if ( $img->exists() ) {
$width = $img->getWidth();
$height = $img->getHeight();
- }
+ }
if ( 0 == $width || 0 == $height ) {
$width = $height = 200;
}
$s .= ' <div class="thumbcaption" '.$textalign.'>'.$zoomicon.$label."</div></div></div>";
return str_replace("\n", ' ', $s);
}
-
+
/**
* Pass a title object, not a title string
*/
wfProfileOut( $fname );
return $s;
}
-
+
/** @todo document */
function makeMediaLink( $name, /* wtf?! */ $url, $alt = '' ) {
$nt = Title::makeTitleSafe( NS_IMAGE, $name );
* @access public
* @todo Handle invalid or missing images better.
*/
- function makeMediaLinkObj( $title, $text = '', $nourl=false ) {
+ function makeMediaLinkObj( $title, $text = '' ) {
if( is_null( $title ) ) {
### HOTFIX. Instead of breaking, return empty string.
return $text;
} else {
- $name = $title->getDBKey();
+ $name = $title->getDBKey();
$img = new Image( $title );
if( $img->exists() ) {
$url = $img->getURL();
- if( $nourl ) {
- $url = str_replace( "http://", UNIQ_PREFIX . "NOPARSEhttp://", $url );
- }
$class = 'internal';
} else {
$upload = Title::makeTitle( NS_SPECIAL, 'Upload' );
$text = $alt;
}
$u = htmlspecialchars( $url );
- return "<a href=\"{$u}\" class='$class' title=\"{$alt}\">{$text}</a>";
+ return "<a href=\"{$u}\" class='$class' title=\"{$alt}\">{$text}</a>";
}
}
function formatComment($comment, $title = NULL) {
$fname = 'Linker::formatComment';
wfProfileIn( $fname );
-
+
global $wgContLang;
$comment = str_replace( "\n", " ", $comment );
$comment = htmlspecialchars( $comment );
wfProfileOut( $fname );
return $comment;
}
-
+
/**
* Wrap a comment in standard punctuation and formatting if
* it's non-empty, otherwise return empty string.
*
* @param string $comment
* @param Title $title
+ * @param bool $deleted
+ *
* @return string
- * @access public
*/
- function commentBlock( $comment, $title = NULL ) {
+ function commentBlock( $comment, $title = NULL, $deleted = false ) {
+ // '*' used to be the comment inserted by the software way back
+ // in antiquity in case none was provided, here for backwards
+ // compatability, acc. to brion -ævar
if( $comment == '' || $comment == '*' ) {
return '';
} else {
- $formatted = $this->formatComment( $comment, $title );
- return " <span class='comment'>($formatted)</span>";
+ if ( $deleted )
+ return " <span class='comment'>(...)</span>";
+ else {
+ $formatted = $this->formatComment( $comment, $title );
+ return " <span class='comment'>($formatted)</span>";
+ }
}
}
global $wgJsMimeType;
$title = wfMsgForContent('toc') ;
return
- '<table id="toc" class="toc" summary="' . $title .'"><tr><td>'
+ '<table id="toc" class="toc" summary="' . $title .'"><tr><td>'
. '<div id="toctitle"><h2>' . $title . "</h2></div>\n"
. $toc
. "</ul>\n</td></tr></table>\n"
return "<div class=\"editsection\" style=\"float:$farside;margin-$nearside:5px;\">[".$url."]</div>";
}
- /**
+ /**
* Split a link trail, return the "inside" portion and the remainder of the trail
* as a two-element array
- *
+ *
* @static
*/
function splitTrail( $trail ) {